//
//  OtherHeadView.m
//  diaoyuren
//
//  Created by 钓鱼人 on 16/1/28.
//  Copyright © 2016年 game. All rights reserved.
//

#import "OtherHeadView.h"
#import "UIImageView+WebCache.h"
@interface OtherHeadView ()

@property (weak, nonatomic) IBOutlet UIImageView *userHead;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageHeight;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageWidth;
@property (weak, nonatomic) IBOutlet UILabel *userName;

@property (weak, nonatomic) IBOutlet UILabel *userGrad;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *gradWidth;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *gradHeight;

@end

@implementation OtherHeadView
-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        
        
    }
    return self;
}

-(void)setMembermodel:(SapceMemberModel *)Membermodel{
    _Membermodel = Membermodel;

    [self.userHead sd_setImageWithURL:[NSURL URLWithString:_Membermodel.avatar]];
        
        self.userName.text = _Membermodel.username;
    
    if (_Membermodel!=nil) {
        self.userGrad.alpha = 1;
        self.userGrad.text = [NSString stringWithFormat:@"Lv.%@",_Membermodel.user_level];
    }
}

-(void)awakeFromNib{
    
    self.backgroundColor = [UIColor clearColor];
    self.userName.backgroundColor = [UIColor clearColor];
    
    self.userGrad.alpha =0;

    self.imageHeight.constant = SCREEN_WIDTH*0.2;
    
    self.imageWidth.constant = self.imageHeight.constant;
    
    radius(self.userHead, self.imageHeight.constant/2);
    
    self.gradHeight.constant = 15;
    self.gradWidth.constant=  25;
}

@end
